
#redirect -file -tee ./log/route.log {source ./scripts/route.tcl}
################################
# setup and proc
# ##############################
source -e -v user_scripts/global_setup.tcl
source -e -v user_scripts/block_setup.tcl
source -e -v user_scripts/loadInnovus.tcl

set current_step "route"
set previous_step "ccopt"

set report_dir "reports/${current_step}"
if {![file exist $report_dir]} {file mkdir $report_dir}

#####################################
# open design
# ##################################
restoreDesign ${DESIGN_LIBRARY}/${DESIGN_NAME}.${previous_step}.dat $DESIGN_NAME

# common setting
source -e -v user_scripts/common_setting.tcl



############################################
# route setting
############################################
source -e user_scripts/common_setting.route.tcl

############################################
#Pre-place customizations
############################################
if {[file exists $PRE_SCRIPT($current_step)]} {
		puts "INFO: Sourcing $PRE_SCRIPT($current_step)"
		source $PRE_SCRIPT($current_step)
} else {
		puts "WARN: $PRE_SCRIPT($current_step) not exist. Skip to source it."
}


############################################
# Core command
############################################
setOptMode -addInstancePrefix ROUTE
setOptMode -addNetPrefix ROUTE_NET
#setOptMode -fixHoldAllowSetupTnsDegrade true
#setOptMode -fixHoldOnExcludedClockNets true
setOptMode -fixHoldAllowResizing true
if {[file exists $ANTENNA_RULE_FILE]} {
		puts "INFO: Sourcing $ANTENNA_RULE_FILE"
		source $ANTENNA_RULE_FILE
} else {
		Puts "WRAN: $ANTENNA_RULE_FILE not exist. Skip to source it."
}

routeDesign

setExtractRCMode -engine postRoute

############################
# PG connection
# ##########################
source -e -v user_scripts/pg_connection.tcl


#####################################
# Post-route customizations
# ##################################
if {[file exists $POST_SCRIPT($current_step)]}  {
		puts "INFO: Sourcing $POST_SCRIPT($current_step)"
		source $POST_SCRIPT($current_step)
} else {
		puts "WARN: $POST_SCRIPT($current_step) not exist. Skip to source it."
}


saveDesign ${DESIGN_LIBRARY}/${DESIGN_NAME}.${current_step}


###################################################
# Report
# ##############################################
if {$REPORT_QOR($current_step)} {
		source -e ./user_scripts/report_qor.tcl
} else {
		puts "INFO: Skip report for step: $current_step"
}

date > ${current_step}

exit






